package com.xbongbong.crm.perform.query.detail;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xbongbong.crm.abstracts.AbstractCrmDetailTopInfoService;
import com.xbongbong.crm.help.MarketActivityHelp;
import com.xbongbong.crm.service.permission.MarketActivityPermissionServiceImpl;
import com.xbongbong.paas.constant.PaasConstant;
import com.xbongbong.paas.domain.entity.ext.ConditionsEntityExt;
import com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt;
import com.xbongbong.paas.domain.entity.ext.PaasFormEntityExt;
import com.xbongbong.paas.enums.ConditionEnum;
import com.xbongbong.paas.enums.PlatFormEnum;
import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.field.LinkListPojo;
import com.xbongbong.paas.help.FormDataFormExplainHelper;
import com.xbongbong.paas.model.PaasAppModel;
import com.xbongbong.paas.model.PaasMenuModel;
import com.xbongbong.paas.pojo.CustomerUserPojo;
import com.xbongbong.paas.pojo.DetailTabPojo;
import com.xbongbong.paas.pojo.FormTitlePoJo;
import com.xbongbong.paas.pojo.HandelDetailPojo;
import com.xbongbong.paas.pojo.SummaryDataPoJo;
import com.xbongbong.paas.pojo.vo.FormDataGetVO;
import com.xbongbong.paas.pojo.vo.ParseSingleRowDataVO;
import com.xbongbong.paas.service.DetailTabConfigService;
import com.xbongbong.paas.service.LinkListService;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.paas.toolbox.util.BeanUtil;
import com.xbongbong.paas.toolbox.wrap.UserVO;
import com.xbongbong.paas.util.TitleUtil;
import com.xbongbong.parent.parse.data.FormDataGetAnalysisDataHelp;
import com.xbongbong.pro.appdetail.pojo.MobileDetailManagerBlockPojo;
import com.xbongbong.pro.appdetail.pojo.MobileDetailMoneyItemPojo;
import com.xbongbong.pro.appdetail.pojo.MobileDetailScriptPojo;
import com.xbongbong.pro.appdetail.pojo.MobileDetailStatusPojo;
import com.xbongbong.pro.detailtab.dto.MarketActivityEffectGetDTO;
import com.xbongbong.pro.detailtab.vo.MarketActivityEffectTargetVO;
import com.xbongbong.pro.enums.DistributorMarkEnum;
import com.xbongbong.pro.enums.permission.enums.ProPermissionAliasEnum;
import com.xbongbong.pro.enums.permission.enums.UpdateProPermissionAliasEnum;
import com.xbongbong.pro.form.pojo.TopPermissionsPoJo;
import com.xbongbong.pro.formdata.pojo.dto.FormDataDetailDTO;
import com.xbongbong.pro.formexplain.pojo.dto.HandlerExplainDTO;
import com.xbongbong.pro.formexplain.pojo.vo.HandlerExplainVO;
import com.xbongbong.paas.service.BusinessButtonService;
import com.xbongbong.saas.constant.BasicConstant;
import com.xbongbong.saas.domain.entity.MarketActivityUserEntity;
import com.xbongbong.saas.enums.BusinessDetailTabEnum;
import com.xbongbong.saas.enums.WorkFlowEnum;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import com.xbongbong.saas.enums.business.ClueEnum;
import com.xbongbong.saas.enums.business.MarketActivityEffectTargetEnum;
import com.xbongbong.saas.enums.dictionary.ClueStatusEnum;
import com.xbongbong.saas.help.MarketManagementBusinessHelp;
import com.xbongbong.saas.model.MarketActivityUserModel;
import com.xbongbong.saas.service.toolbox.help.UserTeamHelp;
import com.xbongbong.sys.domain.entity.UserEntity;
import com.xbongbong.sys.model.UserModel;
import com.xbongbong.util.NameUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @author sunshaoxiang
 * @ClassName MarketActivityDetailTopInfoServiceImpl
 * @Description 市场活动 详情页上部信息 业务层
 * @Date 2022/6/16 10:44
 * @Version 1.0
 **/
@Service("marketActivityDetailTopInfoServiceImpl")
public class MarketActivityDetailTopInfoServiceImpl extends AbstractCrmDetailTopInfoService {

    public static final Logger LOGGER = LoggerFactory.getLogger(MarketActivityDetailTopInfoServiceImpl.class);

    @Resource
    private UserModel userModel;
    @Resource
    private PaasMenuModel paasMenuModel;
    @Resource
    private FormDataGetAnalysisDataHelp formDataGetAnalysisDataHelp;
    @Resource
    private PaasAppModel paasAppModel;
    @Resource
    private FormDataFormExplainHelper formDataFormExplainHelper;
    @Resource
    private MarketManagementBusinessHelp marketManagementBusinessHelp;
    @Resource
    private LinkListService linkListService;
    @Resource
    private DetailTabConfigService detailTabConfigService;
    @Resource
    private MarketActivityUserModel marketActivityUserModel;
    @Resource
    private MarketActivityHelp marketActivityHelp;
    @Resource
    private UserTeamHelp userTeamHelp;
    @Resource
    private BusinessButtonService businessButtonService;
    @Resource
    private MarketActivityPermissionServiceImpl marketActivityPermissionService;

    @Override
    public List<Integer> businessType() {
        return Collections.singletonList(XbbRefTypeEnum.MARKET_ACTIVITY.getCode());
    }


    @Override
    public List<MobileDetailMoneyItemPojo> getMobileDetailMoneyInfo(Integer distributorMark, String corpid, String userId, Integer businessType, Integer subBusinessType, Long dataId, JSONObject data, Map<String, FieldAttrEntity> explainMap, UserVO loginUser, PaasFormDataEntityExt paasFormDataEntityExt) throws XbbException {
        List<MobileDetailMoneyItemPojo> moneyItemList = new ArrayList<>();
        MarketActivityEffectGetDTO marketActivityEffectGetDTO = new MarketActivityEffectGetDTO();
        marketActivityEffectGetDTO.setCorpid(corpid);
        marketActivityEffectGetDTO.setDataId(dataId);
        marketActivityEffectGetDTO.setUserId(userId);
        marketActivityEffectGetDTO.setLoginUser(loginUser);
        //获取指标
        MarketActivityEffectTargetVO marketActivityEffectTargetVO = marketActivityHelp.getMarketActivityEffectTargetVO(marketActivityEffectGetDTO);
        List<ConditionsEntityExt> allClueConditions = Arrays.asList(new ConditionsEntityExt(ClueEnum.MARKET_ACTIVITY_ID.getAttr(), "", ClueEnum.MARKET_ACTIVITY_ID.getFieldType(), ConditionEnum.EQUAL.getSymbol(), Collections.singletonList(dataId)));
        //全部线索
        moneyItemList.add(new MobileDetailMoneyItemPojo(MarketActivityEffectTargetEnum.ALL_CLUE_COUNT.getName(), marketActivityEffectTargetVO.getClueCount(), allClueConditions, true, XbbRefTypeEnum.CLUE.getCode(), BasicConstant.ONE));
        //有效线索(条件： dataId + 线索状态)
        List<ConditionsEntityExt> effectClueConditions = Arrays.asList(new ConditionsEntityExt(ClueEnum.CLUE_STATUS.getAttr(), "", ClueEnum.CLUE_STATUS.getFieldType(), ConditionEnum.NOEQUAL.getSymbol(), Collections.singletonList(ClueStatusEnum.INVALID.getCode())),
                new ConditionsEntityExt(ClueEnum.MARKET_ACTIVITY_ID.getAttr(), "", ClueEnum.MARKET_ACTIVITY_ID.getFieldType(), ConditionEnum.EQUAL.getSymbol(), Collections.singletonList(dataId)));
        moneyItemList.add(new MobileDetailMoneyItemPojo(MarketActivityEffectTargetEnum.EFFECTIVE_CLUE_COUNT.getName(), marketActivityEffectTargetVO.getEffectiveClueCount(), effectClueConditions , true, XbbRefTypeEnum.CLUE.getCode(), BasicConstant.ONE));
        //转化线索数量
        List<ConditionsEntityExt> transformedClueConditions = Arrays.asList(new ConditionsEntityExt(ClueEnum.CLUE_STATUS.getAttr(), "", ClueEnum.CLUE_STATUS.getFieldType(), ConditionEnum.EQUAL.getSymbol(), Collections.singletonList(ClueStatusEnum.TRANSFORMED.getCode())),
                new ConditionsEntityExt(ClueEnum.MARKET_ACTIVITY_ID.getAttr(), "", ClueEnum.MARKET_ACTIVITY_ID.getFieldType(), ConditionEnum.EQUAL.getSymbol(), Collections.singletonList(dataId)));
        moneyItemList.add(new MobileDetailMoneyItemPojo(MarketActivityEffectTargetEnum.TRANSFORMED_CLUE_COUNT.getName(), marketActivityEffectTargetVO.getTransformedClueCount(), transformedClueConditions , true, XbbRefTypeEnum.CLUE.getCode(), BasicConstant.ONE));
        // 下面的指标都是 不需要穿透的，传输了 XbbRefTypeEnum.CLUE.getCode()，其实用不到
        //客户数量
        moneyItemList.add(new MobileDetailMoneyItemPojo(MarketActivityEffectTargetEnum.CUSTOMER_COUNT.getName(), marketActivityEffectTargetVO.getCustomerCount(), null, false, XbbRefTypeEnum.CLUE.getCode(), BasicConstant.ONE));
        //线索转客户转化率
        moneyItemList.add(new MobileDetailMoneyItemPojo(MarketActivityEffectTargetEnum.CLUE_CUSTOMER_RATE.getName(), marketActivityEffectTargetVO.getClueCustomerRate()+"%", null, false, XbbRefTypeEnum.CLUE.getCode(), BasicConstant.ONE));
        //机会数量
        moneyItemList.add(new MobileDetailMoneyItemPojo(MarketActivityEffectTargetEnum.ALL_OPPORTUNITY_COUNT.getName(), marketActivityEffectTargetVO.getAllOpportunityCount(), null, false, XbbRefTypeEnum.CLUE.getCode(), BasicConstant.ONE));
        //机会金额
        moneyItemList.add(new MobileDetailMoneyItemPojo(MarketActivityEffectTargetEnum.ALL_OPPORTUNITY_AMOUNT.getName(), marketActivityEffectTargetVO.getAllOpportunityAmount(), null, false, XbbRefTypeEnum.CLUE.getCode(), BasicConstant.ONE));
        //线索转机会转化率
        moneyItemList.add(new MobileDetailMoneyItemPojo(MarketActivityEffectTargetEnum.CLUE_OPPORTUNITY_RATE.getName(), marketActivityEffectTargetVO.getClueOpportunityRate()+"%", null, false, XbbRefTypeEnum.CLUE.getCode(), BasicConstant.ONE));
        //赢单机会数量
        moneyItemList.add(new MobileDetailMoneyItemPojo(MarketActivityEffectTargetEnum.WIN_OPPORTUNITY_COUNT.getName(), marketActivityEffectTargetVO.getWinOpportunityCount(), null, false, XbbRefTypeEnum.CLUE.getCode(), BasicConstant.ONE));
        //赢单机会金额
        moneyItemList.add(new MobileDetailMoneyItemPojo(MarketActivityEffectTargetEnum.WIN_OPPORTUNITY_AMOUNT.getName(), marketActivityEffectTargetVO.getWinOpportunityAmount(), null, false, XbbRefTypeEnum.CLUE.getCode(), BasicConstant.ONE));

        return moneyItemList;
    }

    @Override
    public JSONArray getBottomBlockInfo(String corpid, String userId, Integer businessType, PaasFormEntityExt formEntity, Long dataId, JSONObject data, Map<String, FieldAttrEntity> explainMap, PaasFormDataEntityExt entityExt, HandlerExplainDTO handlerExplainDTO) throws XbbException {
        Map<String, Object> param = new HashMap<>(PaasConstant.DEFAULT_INITIAL_CAPACITY);
        Map<String, UserEntity> userMap = new HashMap<>(PaasConstant.DEFAULT_INITIAL_CAPACITY);
        List<UserEntity> userEntityList;
        List<CustomerUserPojo> userPojoList = new ArrayList<>();
        List<String> userIdIn = new ArrayList<>();
        userIdIn.add("-1");

        Integer editAfterFinish = 0;
        JSONArray bottomBlockInfo = new JSONArray();
        param.put("corpid", corpid);
        param.put("del", 0);
        param.put("dataId", dataId);
        List<MarketActivityUserEntity> marketActivityUserEntityList = marketActivityUserModel.findEntitys(param);
        marketActivityUserEntityList.forEach(item -> userIdIn.add(item.getUserId()));
        userEntityList = userModel.getByUserIdIn(corpid, userIdIn, true);
        userEntityList.forEach(item -> userMap.put(item.getUserId(), item));
        marketActivityUserEntityList.forEach(item -> {
            UserEntity userEntity = userMap.get(item.getUserId());
            if (userEntity != null) {
                CustomerUserPojo customerUserPojo = new CustomerUserPojo();
                customerUserPojo.setUserId(userEntity.getUserId());
                customerUserPojo.setName(userEntity.getName());
                customerUserPojo.setAvatar(userEntity.getAvatar());
                customerUserPojo.setIsMain(item.getIsMain());
                userPojoList.add(customerUserPojo);
            }
        });
        bottomBlockInfo.add(new MobileDetailManagerBlockPojo(userPojoList));
     return bottomBlockInfo;
    }

    @Override
    public List<MobileDetailScriptPojo> getDetailShowScript(Integer businessType, UserVO loginUser, PaasFormDataEntityExt paasFormDataEntityExt, Map<String, FieldAttrEntity> explainMap) throws XbbException {
        return new ArrayList<>();
    }

    @Override
    public MobileDetailStatusPojo getDetailShowStatus(Integer businessType, JSONObject data) throws XbbException {
        return null;
    }

    @Override
    public Map<String, Object> getDetailShowOperation(String corpid, String userId, Integer businessType, Long dataId, JSONObject data) throws XbbException {
        return new HashMap<>(BasicConstant.DEFAULT_ACCURACY);
    }

    @Override
    public JSONObject returnSaasObject(String corpid, Integer businessType, UserVO userVO, PaasFormDataEntityExt paasFormDataEntityExt) throws XbbException {
        return null;
    }

    @Override
    public List<TopPermissionsPoJo> dingtalkHandleDetailWorkFlow(HandelDetailPojo handelDetailPojo, PaasFormEntityExt formEntity, PaasFormDataEntityExt formData, Map<String, FieldAttrEntity> explainMap) throws XbbException {
        String corpid = formEntity.getCorpid();
        UserVO userVO = handelDetailPojo.getLoginUser();
        Integer businessType = formEntity.getBusinessType();
        List<WorkFlowEnum> workFlowEnumList = WorkFlowEnum.getByBusinessTypeAndPermissionForDingtalk(businessType, userVO.getPermSet());
        List<String> aliasIn = new ArrayList<>();
        workFlowEnumList.forEach(item -> aliasIn.add(XbbRefTypeEnum.getByCode(item.getBusinessType()).getAlias()));
        Map<Integer, String> paasBusinessTypeToName = paasMenuModel.getMenuNameByAlias(aliasIn, corpid, businessType);

        List<TopPermissionsPoJo> topPermissions = businessButtonService.dingtalkDetailCommon(userVO, formEntity, explainMap, formData);
        List<LinkListPojo> linkList = formEntity.getLinkListList();
        topPermissions.addAll(linkListService.getDingtalkCommonButton(linkList, formData.getDel(), userVO, formData.getAppId(), formData.getFormId(), businessType, formEntity.getSaasMark(), corpid));

        for (WorkFlowEnum workFlowEnum : workFlowEnumList) {
            TopPermissionsPoJo topPermissionsPoJo = new TopPermissionsPoJo();
            BeanUtil.copyProperties(workFlowEnum, topPermissionsPoJo);
            if (Objects.equals(workFlowEnum.getFormRelation(), BasicConstant.ONE)) {
                NameUtil.changeValue(paasBusinessTypeToName, topPermissionsPoJo);
            }
            topPermissionsPoJo.setBusinessType(XbbRefTypeEnum.transferBusinessType2Index(workFlowEnum.getBusinessType()));
            topPermissionsPoJo.setDistributorMark(DistributorMarkEnum.OTHER.getCode());
            topPermissions.add(topPermissionsPoJo);
        }
        return topPermissions;
    }


    @Override
    public void handleDetailSpecialField(PaasFormDataEntityExt formData, JSONObject data, Map<String, FieldAttrEntity> explainMap, HandlerExplainDTO handlerExplainDTO) throws XbbException {

    }

    @Override
    public JSONArray getSecondTitleList(FormDataDetailDTO formDataDetailDTO, PaasFormDataEntityExt formData, PaasFormEntityExt formEntity, List<FieldAttrEntity> list, Map<String, FieldAttrEntity> explainMap, JSONObject data) throws XbbException {
        String corpid = formDataDetailDTO.getCorpid();
        Integer businessType = formDataDetailDTO.getBusinessType();
        Long formId = formData.getFormId();
        List<SummaryDataPoJo> summaryList = getSummaryList(formDataDetailDTO, formData, formEntity, list, explainMap, data);
        specialTransferKeyToShowValue(corpid, summaryList, businessType,data, formId);
        JSONArray secondTitle = getSecondTitleList(summaryList, data, formDataDetailDTO.getCorpid(), formEntity.getId());
        return secondTitle;
    }

    @Override
    public JSONArray getTagList(FormDataDetailDTO formDataDetailDTO, PaasFormDataEntityExt paasFormDataEntityExt, PaasFormEntityExt formEntity, List<FieldAttrEntity> list, Map<String, FieldAttrEntity> explainMap, JSONObject data) throws XbbException {
        String corpid = formDataDetailDTO.getCorpid();
        Integer businessType = formEntity.getBusinessType();
        Long dataId = paasFormDataEntityExt.getId();
        String userId = formDataDetailDTO.getUserId();
        Long formId = paasFormDataEntityExt.getFormId();
        List<SummaryDataPoJo> labelsList = getLabelList(formDataDetailDTO, paasFormDataEntityExt, formEntity, list, explainMap, data);
        return getTags(labelsList, corpid, businessType, dataId, userId);
    }

    @Override
    public String getTitle(FormDataDetailDTO formDataDetailDTO, PaasFormDataEntityExt formData, PaasFormEntityExt formEntity, List<FieldAttrEntity> list, Map<String, FieldAttrEntity> explainMap, JSONObject data) throws XbbException {
        List<FormTitlePoJo> formTitleList = getTitleList(formDataDetailDTO, formData, formEntity, list, explainMap, data);
        return TitleUtil.getWebTitle(formTitleList);
    }

    @Override
    public List<DetailTabPojo> handleDetailTab(HandelDetailPojo handelDetailPojo, PaasFormEntityExt formEntity, PaasFormDataEntityExt paasFormDataEntityExt, Map<String, FieldAttrEntity> explainMap, HandlerExplainVO handlerExplainVO, HandlerExplainDTO handlerExplainDTO) throws XbbException {
        Integer businessType = handelDetailPojo.getBusinessType();
        UserVO userVO = handelDetailPojo.getLoginUser();
        List<DetailTabPojo> tabPojoList = new ArrayList<>();
        String corpid = paasFormDataEntityExt.getCorpid();
        String userId = userVO.getUserId();
        List<BusinessDetailTabEnum> tabEnumList;
        Long formId = formEntity.getId();
        String platFormEnum = handlerExplainDTO.getPlatform();
        if (Objects.equals(platFormEnum, PlatFormEnum.WEB.getValue())) {
            tabEnumList = BusinessDetailTabEnum.getByBusinessTypeAndPermission(businessType, userVO.getPermSet());
        } else {
            tabEnumList = BusinessDetailTabEnum.getByBusinessTypeAndPermissionForDingtalk(businessType, userVO.getPermSet());
        }
        // 判断应用是否启用
        boolean isSmsUse = paasAppModel.validateAppEnable(null, XbbRefTypeEnum.GROUP_MESSAGE.getAlias(), 1, corpid);
        // 判断当前员工有没有短信权限
        boolean canSms = isSmsUse && userVO.getPermSet().contains(ProPermissionAliasEnum.SMS_VIEW.getAlias());

        // 获取对应businessType的alias
        List<String> aliasIn = BusinessDetailTabEnum.getAliasIn(tabEnumList);

        // 记录businessType与menuName的关系
        Map<Integer, String> paasBusinessTypeToName = paasMenuModel.getMenuNameByAlias(aliasIn, corpid, businessType);
        //协同团队
        Map<Long, List<String>> mainUserMap = new HashMap<>(PaasConstant.DEFAULT_INITIAL_CAPACITY);
        Map<Long, List<String>> coUserMap = new HashMap<>(PaasConstant.DEFAULT_INITIAL_CAPACITY);
        formDataFormExplainHelper.getUserIdMap(Collections.singletonList(paasFormDataEntityExt.getDataId()),corpid,businessType,false,mainUserMap,coUserMap);

        // 当前数据的创建人、负责人、协同人、当前操作人
        handlerExplainDTO.setLoginUser(userVO);
        handlerExplainDTO.setUserId(userId);
        handlerExplainDTO.setOwnerId(mainUserMap.get(paasFormDataEntityExt.getDataId()));
        handlerExplainDTO.setCoUserId(coUserMap.get(paasFormDataEntityExt.getDataId()));
        handlerExplainDTO.setCreatorId(paasFormDataEntityExt.getCreatorId());
        for (BusinessDetailTabEnum tabEnum : tabEnumList) {
            boolean closed4ClueMenu = marketManagementBusinessHelp.isClosed4ClueMenu(corpid);
            //线索菜单是关闭的，则不能有“活动成效”"销售线索"2个tab
            if(closed4ClueMenu && (Objects.equals(BusinessDetailTabEnum.ACTIVITY_EFFECT,tabEnum) || Objects.equals(BusinessDetailTabEnum.SALE_CLUE,tabEnum))){
                continue;
            }
            DetailTabPojo detailTabPojo = new DetailTabPojo();
            BeanUtil.copyProperties(tabEnum.getAnEnum(), detailTabPojo);
            changeTabEnumName(paasBusinessTypeToName, tabEnum, detailTabPojo);
            detailTabPojo.setAttr(detailTabPojo.getKey());
            tabPojoList.add(detailTabPojo);
        }
        handleTeamTab(tabPojoList, explainMap);
        List<LinkListPojo> linkList = JSONArray.parseArray(formEntity.getAssociationList(), LinkListPojo.class);
        handlerExplainVO.setAppId(formEntity.getAppId());
        handlerExplainVO.setFormId(formEntity.getId());
        // 公共tab
        tabPojoList.addAll(linkListService.commonTab(corpid, userVO, handlerExplainVO, handlerExplainDTO, businessType, paasFormDataEntityExt.getDel(), linkList));
        // tab排序
        tabPojoList = detailTabConfigService.handleDetailTabSort(userVO.getUserId(), corpid, handlerExplainVO.getFormId(), businessType, tabPojoList);
        return tabPojoList;
    }

    @Override
    public void checkPermission(PaasFormEntityExt formEntity, PaasFormDataEntityExt paasFormDataEntityExt, UserVO loginUser, Integer subBusinessType) throws XbbException {
        if (loginUser.isMaxDataPermission()){
            return ;
        }
        Integer flowStatus = paasFormDataEntityExt.getFlowStatus();
        Long menuId = formEntity.getMenuId();
        Integer saasMark = formEntity.getSaasMark();
        Integer businessType = formEntity.getBusinessType();


        // 查看权限校验
        verifyQueryPermission(businessType, loginUser,saasMark ,menuId ,flowStatus);
        //团队权限&&共享权限校验
        marketActivityPermissionService.checkPermission(formEntity, paasFormDataEntityExt, loginUser, subBusinessType);
    }


    @Override
    public JSONObject analysisData(PaasFormDataEntityExt paasFormDataEntityExt, HandlerExplainDTO handlerExplainDTO, HandlerExplainVO handlerExplainVO) throws XbbException {
        Long formId = paasFormDataEntityExt.getFormId();
        List<FieldAttrEntity> list = handlerExplainVO.getHeadList();
        Map<String, FieldAttrEntity> explainMap = new HashMap<>(list.size());
        Integer businessType = handlerExplainDTO.getBusinessType();
        String corpid = handlerExplainDTO.getCorpid();
        list.forEach(item->explainMap.put(item.getAttr(), item));

        ParseSingleRowDataVO parseSingleRowDataVO = commonAnalysisData(paasFormDataEntityExt, handlerExplainDTO, handlerExplainVO, list, explainMap);
        JSONObject data = parseSingleRowDataVO.getResult();
        //处理千分位
        FormDataGetVO formDataGetVO = new FormDataGetVO();
        formDataGetVO.setData(data);
        formDataGetAnalysisDataHelp.analysisGetOfThousandBits(formDataGetVO, list, false);
        return data;
    }

}
